package com.qf.mrmd.controller;

import com.qf.mrmd.entity.Shop;
import com.qf.mrmd.result.ResponseData;
import com.qf.mrmd.service.ShopService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Shop)表控制层
 *
 * @author makejava
 * @since 2021-07-14 14:42:30
 */
@RestController
@RequestMapping("shops")
public class ShopController {
    /**
     * 服务对象
     */
    @Resource
    private ShopService shopService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation(value = "查询单个商家详情",notes = "通过id查询商家信息")
    @ApiImplicitParam(name = "id",value = "商家id",dataType = "integer")
    @GetMapping("/{id}")
    public ResponseData shopDetail(@PathVariable Integer id) {

        return shopService.queryById(id);
    }

    @ApiOperation(value = "查询所有商家名称")
    @GetMapping("/all")
    @ApiImplicitParam(name = "token",value = "用户信息token,必须携带",dataType = "string",paramType = "header",required = true)
    public ResponseData shopNameList() {

        return shopService.queryNameList();
    }

}
